package com.heatingcharge.controller.unit;


import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.heatingcharge.common.util.R;
import com.heatingcharge.dto.ResHouseDTO;
import com.heatingcharge.entity.unit.ResHouse;
import com.heatingcharge.service.unit.IResHouseService;
import com.heatingcharge.service.unit.IResUnitService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;

import org.springframework.web.bind.annotation.RestController;

/**
 * <p>
 * 单元表 前端控制器
 * </p>
 *
 * @author devin.jiang
 * @since 2019-07-12
 */
@RestController
@RequestMapping("/res-unit")
public class ResUnitController {
    @Autowired
    IResHouseService resHouseService;
    @GetMapping("/{unitId}/res-house")
    public R getHouseByUnitId(ResHouseDTO resHouseDTO){
        QueryWrapper<ResHouse> resHouseQueryWrapper=new QueryWrapper<>();
        resHouseQueryWrapper.eq("unit_id",resHouseDTO.getUnitId());
        return R.ok(resHouseService.list(resHouseQueryWrapper));
    }
}

